<template>
  <svg aria-hidden="true" :class="styles['svg-icon']">
    <use :xlink:href="iconName" :fill="color" />
  </svg>
</template>

<!--使用案例: <SvgIcon name="clover" color="#409eff" width="16px" height="16px"></SvgIcon>-->
<script setup name="SvgIcon">
import {defineProps, computed} from 'vue'

const props = defineProps({
  name: {
    type: String,
    required: true
  },
  color: {
    type: String,
    default: '#409eff'
  },
  width: {
    type: String,
    default: '16px'
  },
  height: {
    type: String,
    default: '16px'
  }
})


const iconName = computed(() => `#icon-${props.name}`)

</script>

<style lang="less" src="./index.less" module="styles">
</style>
